package com.cg.controller;

import com.cg.dto.DateDto;
import com.cg.dto.Result;
import com.cg.dto.ResultUtils;
import com.cg.service.ArrangeService;
import com.cg.vo.ArrangeDoctorVo;
import com.cg.vo.DateListVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

/**
 * (Arrange)表控制层
 *
 * @author chengong
 * @since 2024-01-08 12:02:04
 */
@RestController
@RequestMapping("/arrange")
public class ArrangeController {
    /**
     * 服务对象
     */
    @Resource
    private ArrangeService arrangeService;


    /**
     * 预约-选择科室
     */
    @PostMapping("/queryDateList")
    public Result<DateListVo> queryDateList(@RequestBody DateDto dateDto) throws ParseException{
        DateListVo dateListVo = arrangeService.queryDateList(dateDto);
        return ResultUtils.returnDataSuccess(dateListVo);
    }


    /**
     * 根据divideId和时间查询医生信息
     */
    @PostMapping("/queryArrangeDoctor")
    public Result<List<ArrangeDoctorVo>> queryArrangeDoctor(@RequestBody DateDto dateDto){
        List<ArrangeDoctorVo> arrangeDoctorVoList = arrangeService.queryArrangeDoctor(dateDto);
        return ResultUtils.returnDataSuccess(arrangeDoctorVoList);
    }
}

